package crp.core.timetable.domain.models;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

import java.time.Instant;
import java.util.Objects;

@Getter
@Builder
@AllArgsConstructor
public class TimetableKey {
    private final String courseId;
    private final Instant startAt;

    public boolean match(TimetableEntity timetable) {
        return Objects.equals(timetable.getCourseId(), courseId) && !timetable.getStartAt().isAfter(startAt);
    }
}
